const Koa = require('koa')
const app = new Koa()
const router = require('koa-router')()

function findUsers() {
  // koa路由
  router.get('/api/users', async (ctx, next) => {
    ctx.body = ctx.query
  })
  // 注册之后才能使用
  app.use(router.routes())
}

module.exports = { findUsers, app }

// app.listen(3000, () => {
//   console.log(`server port is 3000`)
// })
